package com.healthcloud.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.healthcloud.dao.UserFamilyMapper;
import com.healthcloud.entity.UserFamily;
import com.healthcloud.service.UserFamilyService;

/**
 * @author houxianghua
 * @since: 2016-04-18
 */
@Service
@Transactional
public class UserFamilyServiceImpl implements UserFamilyService {

    @Autowired
    private UserFamilyMapper userMapper;

    @Override
    public UserFamily getById(Long id) {
        return userMapper.get(id);
    }

    @Override
    public List<UserFamily> getByUserId(Long userId) {
        return userMapper.getByUserId(userId);
    }

    @Override
    public List<UserFamily> findByEntityAll(UserFamily entity) {
        return userMapper.findByEntityAll(entity);
    }

    @Override
    public int save(UserFamily entity) {
        return userMapper.save(entity);
    }

    @Override
    public int update(UserFamily entity) {
        return userMapper.update(entity);
    }

    @Override
    public int delete(Long id) {
        return userMapper.delete(id);
    }

    @Override
    @Transactional
    public int deletes(Long[] ids) {
        return userMapper.deleteBatch(ids);
    }

    @Override
    public int delete(Long userId, Long patientId) {
        return userMapper.deleteByUserIdPatientId(userId, patientId);
    }
}